package com.foreknow.view;
import com.foreknow.service.BusinessService;
import com.foreknow.service.impl.BusinessServiceImpl;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Delinfo extends JFrame {

    private JPanel contentPane;
    private JTextField textField;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Delinfo frame = new Delinfo();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public Delinfo() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 684, 439);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);

        JLabel lblNewLabel = new JLabel("\u8981\u5220\u9664\u7684id");
        lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 19));
        lblNewLabel.setBounds(62, 88, 119, 50);
        contentPane.add(lblNewLabel);

        textField = new JTextField();
        textField.setBounds(207, 94, 220, 43);
        contentPane.add(textField);
        textField.setColumns(10);

        JButton btnNewButton = new JButton("\u786E\u5B9A");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String id=textField.getText();
                int iid = Integer.parseInt(id);
                BusinessService businessService=new BusinessServiceImpl();
                businessService.del(iid);

                System.out.println("确定删除");
            }
        });
        btnNewButton.setBounds(101, 230, 113, 27);
        contentPane.add(btnNewButton);

        JButton btnNewButton_1 = new JButton("\u53D6\u6D88");
        btnNewButton_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("取消删除");
                MainWindow mainWindow = new MainWindow();
                mainWindow.setVisible(true);
                Delinfo.this.dispose();
            }
        });
        btnNewButton_1.setBounds(340, 230, 113, 27);
        contentPane.add(btnNewButton_1);
    }

}
